package com.webside.subject.service.impl;

import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.webside.base.baseservice.impl.AbstractService;
import com.webside.subject.mapper.SubjectMapper;
import com.webside.subject.mapper.SubjectSeriesMapper;
import com.webside.subject.model.SubjectEntity;
import com.webside.subject.model.SubjectSeriesEntity;
import com.webside.subject.service.SubjectSeriesService;
import com.webside.subject.service.SubjectService;
@Service("SubjectSeriesService")
public class SubjectSeriesServiceImpl extends AbstractService<SubjectSeriesEntity, Long> implements SubjectSeriesService {
	@Autowired
	private SubjectSeriesMapper subjectSeriesMapper;
	//这句必须要加上。不然会报空指针异常，因为在实际调用的时候不是BaseMapper调用，而是具体的mapper，这里为userMapper
	@Autowired
	public void setBaseMapper() {
		super.setBaseMapper(subjectSeriesMapper);
	}
	public List<SubjectSeriesEntity> queryAll() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public int update(SubjectSeriesEntity subject) {
		// TODO Auto-generated method stub
		return 0;
	}
	@Override
	public int add(SubjectSeriesEntity subjectseries) {
		Date now = new Date();
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");// 可以方便地修改日期格式
		String nowTime = dateFormat.format(now);
		ParsePosition pos = new ParsePosition(0);
		Date currentTime_2 = dateFormat.parse(nowTime, pos);
		subjectseries.setCreateTime(currentTime_2);
		subjectseries.setDeleteState(1);
		return subjectSeriesMapper.insert(subjectseries);
	}
	@Override
	public int count(Map<String, Object> parameter) {
		// TODO Auto-generated method stub
		return super.count(parameter);
	}
	@Override
	public int delete(List<String> subjectId) {
		// TODO Auto-generated method stub
		return 0;
	}
	@Override
	public List<String> selectByName() {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public int countBySubjectId(int id) {
		// TODO Auto-generated method stub
		return subjectSeriesMapper.queryCountBySubjectId(id);
	}
	@Override
	public List<SubjectSeriesEntity> queryListByPage(Map<String, Object> parameter) {
		// TODO Auto-generated method stub
		return super.queryListByPage(parameter);
	}
	@Override
	public List<SubjectSeriesEntity> queryListBySubjectId(Map<String, Object> parameters) {
		// TODO Auto-generated method stub
		return subjectSeriesMapper.querySeriesBySubjectId(parameters);
	}
	@Override
	public void deletesub(SubjectSeriesEntity subjectseries) {
		// TODO Auto-generated method stub
		subjectSeriesMapper.deleteBySubjectSeries(subjectseries);
	}
	@Override
	public SubjectSeriesEntity selectBySubjectSeries(SubjectSeriesEntity subjectseries) {
		// TODO Auto-generated method stub
		return subjectSeriesMapper.selectBySubjectSeries(subjectseries);
	}
	@Override
	public List<SubjectSeriesEntity> querySubjectListByPage(Map<String, Object> parameters) {
		return subjectSeriesMapper.querySubNameSeriesBySubjectId(parameters);
	}
}
